﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace DemoUserControl.Form_Control
{
    public partial class treeView : UserControl
    {
        public delegate void customHandler(object sender, String i, String a);
        public event customHandler loadTreeView;
        public treeView()
        {
            InitializeComponent();
        }
        public void Add_TreeNode()
        {
            treeView1.Nodes.Add("Form All");
            for (int i = 1; i <= 5; i++)
            {
                treeView1.Nodes[0].Nodes.Add(i.ToString(), "Form " + i);
            }
        }
        private void treeView1_BeforeSelect(object sender, TreeViewEventArgs e)
        {
            loadTreeView(sender, e.Node.Name, e.Node.Name);
        }
    }
}
